package com.market.dao;

import com.market.domain.OrderDetail;
import com.market.domain.PurchaseDetail;


public interface PurchaseDetailDao extends GenericDao<PurchaseDetail, Long> {
	
	/**
	 * First the inventory of product corresponding to this purchase detail will be
	 * update, product.inventory = product.inventory +
	 * purchaseDetail.arrivedQuantity. then this purchase detail will be saved to
	 * DB. .
	 * 
	 * @param orderDetail
	 * @return
	 */
	
	public PurchaseDetail saveAndUpdateInventory(PurchaseDetail purchaseDetail);
	
	/**
	 * This method remove purchase detail from DB, the inventory of product
	 * corresponding to this purchase detail will be updated, product.inventory =
	 * product.inventory - orderDetail.getPurchaseQuantity
	 * 
	 * @param orderDetal
	 * @return
	 */
	public PurchaseDetail removeAndUpdateInventory(PurchaseDetail purchaseDetail);
	
	
	/**
	 * This method plus purchasedQuantity to inventory
	 * 
	 * @param PurchaseDetail
	 */
	
	public PurchaseDetail process(PurchaseDetail purchaseDetail);

	
	
	/**
	 * This method minus purchasedQuantity from inventory
	 * 
	 * @param PurchaseDetail
	 */
	public PurchaseDetail unProcess(PurchaseDetail purchaseDetail);
	
}
